#ifndef QLOGDATABASEVIEW_H
#define QLOGDATABASEVIEW_H

#include "corelibglobal.h"

#include <QWidget>
#include <QTreeWidget>
#include <QSqlQuery>

class StyledBar;

#define MAX_SHOW    100

class CORELIB_EXPORT QLogDatabaseView : public QWidget
{
    Q_OBJECT
public:
    explicit QLogDatabaseView(QWidget *parent = 0);
    
    void    set_tool_bar(QList<QAction*> list);

    bool    load(const QString &path);
signals:
    void    first_enabled(bool enabled);
    void    prev_enabled(bool enabled);
    void    next_enabled(bool enabled);
    void    last_enabled(bool enabled);
    void    save_enabled(bool enabled);
protected:
    void    show_page(int index);
protected slots:
    void    first();
    void    prev();
    void    next();
    void    last();
    void    save();
    void    clear();
    void    info();
protected:
    StyledBar       *m_styled_bar;
    QTreeWidget     *m_tree_widget;
    QString         m_path;
    QSqlQuery       m_query;
    QSqlQuery       m_system_query;
    int             m_current_index;
    int             m_size;
    
};

#endif // QLOGDATABASEVIEW_H
